package thread;

import java.util.Scanner;

public class SleepDemo {
    public static void main(String[] args) {
        System.out.println("程序开始了");
        Scanner scanner = new Scanner(System.in);
        try {
            System.out.println("请输入一个整数");
            int num = scanner.nextInt();
            while (num != -1){
                Thread.sleep(1000);//
                System.out.println(num);
                num--;
            }
        System.out.println("时间到");
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("程序结束了");
    }
}
